using Aurora.TaskScheduler.Abstractions;
using Aurora.TaskScheduler.Abstractions.BaseModel;
using Gateway.IApplication.UserMessage;

namespace Gateway.UI.Api.TaskJobs;

/// <summary>
/// 用户将所有消息标记为已读
/// </summary>
public class UserReadAllMessageJob : ITaskJob<string>
{
    private readonly IUserMessageApp _messageApp;

    /// <summary>
    /// 
    /// </summary>
    /// <param name="messageApp"></param>
    public UserReadAllMessageJob(IUserMessageApp messageApp)
    {
        _messageApp = messageApp;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="parameter"></param>
    /// <returns></returns>
    public async Task<JobResult> ExecuteAsync(string parameter)
    {
        await _messageApp.ReadAll(parameter);
        return new JobResult()
        {
            Success = true,
            Message = "执行成功"
        };
    }
}